<template>
  <div>
    <van-nav-bar title="专题详情" left-text="返回" left-arrow @click-left="onClickLeft" class="navbar"/>
    <div class="contentBox" v-html="content"></div>
    <div class="topic">
      <p class="title">专题推荐</p>
      <div class="item" v-for="item in recommendList" :key="item.id">
        <img :src="item.scene_pic_url" alt />
        <p>{{item.title}}</p>
      </div>
    </div>
  </div>
</template>

<script>
import { detailaction } from "@/api/topic";
export default {
  data() {
    return {
      content: "",
      recommendList:''
    };
  },
  created() {
    detailaction({
      id: this.$route.query.id
    }).then(res => {
      console.log(res);
      this.content = res.data.content;
      this.recommendList = res.recommendList;
    });
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1);
    }
  }
};
</script>

<style lang="scss" scoped>
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 999;
}
.contentBox /deep/ img {
  width: 10rem;
}
.topic {
  width: 9.2rem;
  height: auto;
  margin: 0 0.4rem;
  .title {
    text-align: center;
    background: #f4f4f4;
    font-size: 0.4rem;
    color: #999;
    padding: 0.4rem 0;
  }
  .item {
    width: 100%;
    padding: 0.32rem 0.32rem 0.4rem 0.32rem;
    margin-bottom: 0.4rem;
    background: #fff;
    box-sizing: border-box;
    img {
      height: 3.70667rem;
      width: 8.56rem;
      display: block;
    }
    p {
      display: block;
      margin-top: 0.4rem;
      font-size: 0.37333rem;
    }
  }
}
</style>